extends "../bunao-2/bunao-2.gd"


func _extInit():
	._extInit()
	lv = 3             #等级的设置
	addSkill("战斗开始时，赋予自身及正前方一名友军<航空护卫>：被护航目标受到致命伤害时，\n由自己的舰载机来承担", "航空护卫")

var bindCha
func _onBattleStart():
	._onBattleStart()
	var cha = sys.main.matCha(cell + Vector2(1, 0))
	if cha != null and cha.team == team:
		bindCha = cha
		castBuff(cha, b_bunao2.new())
	castBuff(self, b_bunao2.new())	

class b_bunao2:
	extends "../../../azurlane_ctrl/AzurBuff.gd"
	func _init():
		attInit()
		id = "b_bunao2"
		dispel = 2
		buffName = "航空护卫"
	func _connect():
		masCha.connect("onHurtDeath", self, "onHurtDeath")
	func onHurtDeath(atkInfo):
		var cha = null
		for i in casCha.summedCha:
			if not i.isDeath:
				cha = i
				break
		if atkInfo.hurtChaDead and cha != null:
			atkInfo.hurtChaDead = false
			atkInfo.atkCha.azurHurtChara(cha, atkInfo.atkVal, atkInfo.hurtType, atkInfo.atkType, atkInfo.skill)
			